import org.apache.hc.client5.http.classic.methods.HttpGet;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
import org.apache.hc.client5.http.impl.classic.HttpClients;
import org.apache.hc.core5.http.HttpEntity;
import org.apache.hc.core5.http.io.entity.EntityUtils;

public class test1 {
    public static void main(String[] args) {
         CloseableHttpClient httpClient= HttpClients.createDefault();
//         输入网址 创建发起get请求
         HttpGet httpGet = new HttpGet("https://github.com/jackfrued/Python-100-Days/blob/3e42ffafb6e214472d436c7acc2656d5f2659404/Day01-15/04.%E5%BE%AA%E7%8E%AF%E7%BB%93%E6%9E%84.md");
//        System.out.println("发送的请求"+httpGet);
        try {
            CloseableHttpResponse response = httpClient.execute(httpGet);
            if (response.getCode()==200){
                 HttpEntity httpEntity = response.getEntity();
                 String utf8 = EntityUtils.toString(httpEntity, "utf8");
                System.out.println(utf8);
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
